﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FanaticRock.Core.Helpers
{
    public class CancellationHelper
    {
        public static void CreateCancellationTokenSource(ref CancellationTokenSource source)
        {
            DisposeCancellationTokenSource(ref source);
            source = new CancellationTokenSource();
        }

        public static void DisposeCancellationTokenSource(ref CancellationTokenSource source)
        {
            if (source == null) return;
            source.Dispose();
        }
    }
}
